<?php
namespace app\common\model\mysql;

use think\Model;
class SpecsValue extends Model{
	// 指定数据库表
	public $table = 'mall_specs_value';

	public function getNormalBySpecsId($specsId,$field='*'){
		$where = [
			'specs_id' => $specsId,
			'status' => config('status.mysql.normal'),
		];

		$res = $this->where($where)
			->field($field)
			->select();

		return $res;
	}

	//根据ID更新状态
	public function updateById($id,$data){
		$data['update_time'] = time();
		$where = [
			'id' => $id,
		];
		return $this->where($where)->save($data);
	}

	public function getNormalInIds($ids){
		$result = $this->where('status','=',config('status.mysql.normal'))
			->whereIn('id',$ids)
			->select();

		return $result;
	}
}